<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        var_dump($_POST);
        $username=$_POST['username'];
        echo "<br>";
        $password=$_POST['password'];
        $pwd2=$_POST['pwd2'];
        $verify=$_POST['verify'];
        echo "$username $password $pwd2 $verify<br>";
        ?>
        
        <?php
        //INSERT INTO users(uname,upwd,uemail)VALUES('qwer','123','123456789@12.com');
        //$sql="INSERT INTO users(uname,upwd,uemail)VALUES('qwer','123','123456789@12.com');";
        //第一步：连接数据库
        $link=mysqli_connect("localhost","root","");
        mysqli_select_db($link, "nhcar");
        mysqli_set_charset($link, "utf8");
        echo "<br>";
        //第二步：操作数据表
        $sql="INSERT INTO users(uname,upwd,uemail)VALUES('$username','$password','123456789@123.com');";
        $result=mysqli_query($link,$sql);
        //var_dump($result);
        //echo "<br>$sql</br>";
        echo "<br>";
        //exit();
        //第三步：处理结果
        if($result){
            echo "<script>alert('注册成功!');location.href='login.php'</script>";
        }else {
             echo "<script>alert('注册失败!');location.href='register.php'</script>";
        }
        ?>
    </body>
</html>
